﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace BlogPlat.Model
{
    [MetadataType(typeof(CategoryMetadata))]
    public partial class Category
    {
        public CategoryItem DropDownListItem { get; set; }
    }
    
    public class CategoryMetadata
    {
        [HiddenInput(DisplayValue = false)]
        public int CategoryID { get; set; }

        [DisplayName("Parent Category")]
        public int ParentID { get; set; }

        [Required(ErrorMessage = "Please enter category name")]
        [StringLength(100)]
        [DisplayName("Category Name")]
        public string CategoryName { get; set; }

        [Required(ErrorMessage = "Please enter category friendly url")]
        [StringLength(200)]
        [DisplayName("Category Friendly Url")]
        public string FriendlyUrl { get; set; }
    }

    public class CategoryItem
    {
        public string Text { get; set; }
        public string Value { get; set; }
    }    
}
